//
//  ViewController.m
//  控件
//
//  Created by 宋 on 16/2/29.
//  Copyright © 2016年 宋. All rights reserved.
//

#import "ViewController.h"
#import "otherclass.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UILabel *mylabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 60, 320, 40)];
     mylabel.text = @"汪晓";
     mylabel.backgroundColor = [UIColor grayColor];
     mylabel.textColor = [UIColor whiteColor];
     mylabel.textAlignment = NSTextAlignmentCenter;
     [self.view addSubview:mylabel];
    
    UIButton *mybutton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    mybutton.frame = CGRectMake(100, 150, 110, 40);
    mybutton.backgroundColor = [UIColor blueColor];
    mybutton.tintColor = [UIColor redColor];
    [self.view addSubview:mybutton];
    [mybutton setTitle:@"一起" forState:UIControlStateNormal];
    [mybutton setTitle:@"被点中" forState:UIControlStateHighlighted];
    
    
    otherclass *class = [otherclass new];
    [mybutton addTarget:class action:@selector(action) forControlEvents:UIControlStateNormal];
    
    [mybutton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [mybutton setTitleColor:[UIColor purpleColor] forState:UIControlStateHighlighted];
    
    [mybutton setTitleShadowColor:[UIColor redColor] forState:UIControlStateNormal];
    
    
    UIButton *mybutton1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    mybutton1.frame = CGRectMake(100, 250, 110, 40);
    [self.view addSubview:mybutton1];
    [mybutton1 setBackgroundImage:[UIImage imageNamed:@"green.png"] forState:UIControlStateNormal];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
